package cn.theten52.demo.patterns.design.visitor.base;

import java.util.ArrayList;
import java.util.List;

/**
 * Member容器，访问者的功能实现辅助类
 *
 * @author wangjin
 * @date 2021/4/5
 */
public class StaffObjectStructure {
    private final List<Member> members = new ArrayList<>();

    public void add(Member member) {
        members.add(member);
    }

    public void accept(Visitor<Member> visitor) {
        members.forEach(member -> member.accept(visitor));
    }
}
